package com.ruoyi.resource.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.resource.mapper.ResInfomationMapper;
import com.ruoyi.resource.domain.ResInfomation;
import com.ruoyi.resource.service.IResInfomationService;

/**
 * 资讯Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-12-20
 */
@Service
public class ResInfomationServiceImpl implements IResInfomationService 
{
    @Autowired
    private ResInfomationMapper resInfomationMapper;

    /**
     * 查询资讯
     * 
     * @param resInfomation 资讯
     * @return 资讯
     */
    @Override
    public List<ResInfomation> selectResInfomationById(ResInfomation resInfomation)
    {
        resInfomationMapper.updateResInfomationView(resInfomation.getId());
        return resInfomationMapper.selectResInfomationById(resInfomation);
    }

    /**
     * 查询资讯列表
     * 
     * @param resInfomation 资讯
     * @return 资讯
     */
    @Override
    public List<ResInfomation> selectResInfomationList(ResInfomation resInfomation)
    {
        return resInfomationMapper.selectResInfomationList(resInfomation);
    }

    /**
     * 查询资讯列表
     *
     * @param resInfomation 资讯
     * @return 资讯
     */
    @Override
    public List<ResInfomation> selectResInfomationHotList(ResInfomation resInfomation)
    {
        return resInfomationMapper.selectResInfomationHotList(resInfomation);
    }

    /**
     * 查询资讯列表
     *
     * @param resInfomation 资讯
     * @return 资讯
     */
    @Override
    public List<ResInfomation> selectResInfomationNewsFeedList(ResInfomation resInfomation)
    {
        return resInfomationMapper.selectResInfomationNewsFeedList(resInfomation);
    }

    /**
     * 新增资讯
     * 
     * @param resInfomation 资讯
     * @return 结果
     */
    @Override
    public int insertResInfomation(ResInfomation resInfomation)
    {
        return resInfomationMapper.insertResInfomation(resInfomation);
    }

    /**
     * 修改资讯
     * 
     * @param resInfomation 资讯
     * @return 结果
     */
    @Override
    public int updateResInfomation(ResInfomation resInfomation)
    {
        return resInfomationMapper.updateResInfomation(resInfomation);
    }

    /**
     * 修改资讯点赞
     *
     * @param id 资讯主键
     * @return 结果
     */
    @Override
    public int updateResInfomationPraise(Long id)
    {
        return resInfomationMapper.updateResInfomationPraise(id);
    }
    /**
     * 修改资讯收藏
     *
     * @param id 资讯主键
     * @return 结果
     */
    @Override
    public int updateResInfomationCollect(Long id)
    {
        return resInfomationMapper.updateResInfomationCollect(id);
    }
    /**
     * 修改资讯分享
     *
     * @param id 资讯主键
     * @return 结果
     */
    @Override
    public int updateResInfomationShare(Long id)
    {
        return resInfomationMapper.updateResInfomationShare(id);
    }

    /**
     * 批量删除资讯
     * 
     * @param ids 需要删除的资讯主键
     * @return 结果
     */
    @Override
    public int deleteResInfomationByIds(Long[] ids)
    {
        return resInfomationMapper.deleteResInfomationByIds(ids);
    }

    /**
     * 删除资讯信息
     * 
     * @param id 资讯主键
     * @return 结果
     */
    @Override
    public int deleteResInfomationById(Long id)
    {
        return resInfomationMapper.deleteResInfomationById(id);
    }
}
